package com.dispacher.processor;

import com.dispacher.config.Constants;
import com.dispacher.processor.impl.DefaultProcessor;
import com.dispacher.processor.impl.DirectJspProcessor;

public class ProcessorFactory {
	public static Processor createDefaultProcessor() {
		return new DefaultProcessor();
	}

	public static Processor createProcessorByUri(String uri) {
		Processor processor = null;
		if (uri.indexOf(Constants.DIRECT_URL_SUFFIX) != -1) {
			processor = new DirectJspProcessor();
		} else {
			processor = new DefaultProcessor();
		}
		processor.setRequestURL(uri);
		return processor;
	}
}
